<?php
/**
 * User: Hufeng
 * Date: 2016/6/12 17:44
 * Desc: 公用函数库
 */
function httpCurl($url,$param){
    $ch = curl_init();  //初始化
    curl_setopt($ch, CURLOPT_URL, $url); //设置url
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //不直接输出,以文件流返回
    curl_setopt($ch, CURLOPT_TIMEOUT, 15); //超时
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不需要验证对方的证书
    curl_setopt($ch, CURLOPT_POST, true);   //开启post参数传递
    curl_setopt($ch, CURLOPT_POSTFIELDS, $param); //post数组参数
    $response = curl_exec($ch); //执行,返回header body
    curl_close($ch);//关闭
    return $response;
}